//
//  UserInfoManger.h
//  WeCommunity
//
//  Created by mac on 2017/6/20.
//  Copyright © 2017年 lzy. All rights reserved.
//

#import <Foundation/Foundation.h>
#include "ContactModel.h"
#include "ReactiveObjC.h"



@protocol UserInfoMangerDelegateDelegate <NSObject>

//用户数据更新
-(void)userInfoMangerUpdateUserData:(BOOL)isLogin user:(ContactModel *)user;

@end


@interface UserInfoManger : NSObject

@property (nonatomic,assign) id<UserInfoMangerDelegateDelegate> delegate;

@property (nonatomic,assign) id<UserInfoMangerDelegateDelegate> infoDelegate;

@property (nonatomic,strong) ContactModel * contact;

@property (nonatomic,assign) BOOL isLogin;      //用户是否登陆

@property (nonatomic,assign) BOOL userIsAdmin;      //用户是否是管理员



+(UserInfoManger *)shared;

#pragma mark - 验证 SessionToken
-(void)verifySessionToken;

#pragma mark - 更新用户信息
-(void)reloadUserInfo;

#pragma mark - 去登录
-(BOOL)needGotoLoginLogic;

#pragma mark - 退出登录
-(void)logOutLogic;

#pragma mark - 保存头像
-(void)saveHeadImage:(UIImage *)headImage
            complete:(void(^)(BOOL success,NSString * error))complete;

#pragma mark - 保存昵称
-(void)saveUserNickName:(NSString *)nickName
               complete:(void(^)(BOOL success,NSString * error))complete;

#pragma mark - 保存微信号
-(void)saveUserWXUserName:(NSString *)userName
                 complete:(void(^)(BOOL success,NSString * error))complete;

#pragma mark - 保存性别
-(void)saveUserSex:(NSString *)sex
          complete:(void(^)(BOOL success,NSString * error))complete;

#pragma mark - 增减积分   number 负数表示减积分  负数自动记录使用的积分
-(void)addCoins:(NSNumber *)number complete:(void(^)(BOOL success,NSString * error))complete;

#pragma mark - 是否购买了去除广告
-(BOOL)isRemovedAD;

@end
